#include "Command.hpp"



int main()
{

    key_t key = GetShmKey();
    
    //获取shmid
    int shmid = GetShm(key,defaultsize);
    cout<<shmid<<endl;

    //挂接到共享内存
    char* addr = (char*)AttachShm((uint64_t)shmid);
    cout << "Attach shm success, addr: " << ToHex((uint64_t)addr) << std::endl;

    //开始写入内容
    for(char ch = 'a';ch<='z';ch++)
    {
        addr[ch-'a'] = ch;
        sleep(1);
    }
    
    //断开挂接
    DetachShm(addr);
    cout << "Detach shm success, addr: " << ToHex((uint64_t)addr) << std::endl;


    return 0;
}